<title>建设项目配套绿地审核事后监督检查登记</title>
<!-- /section:settings.box -->
<div class="row greening_list">
	<div class="col-xs-12">
		<div class="ad_so">
			<select class="chosen-select" id="hx_sfwg">
				<option value="">全部</option>
				<option value="完工">完工</option>
				<option value="未完工">未完工</option>
			</select> <input type="text" id="hx_name" class="input-large"
				placeholder="请输入要查找的项目名称搜索">
			<button type="button" class="btn btn-info serach">
				<i class="glyphicon glyphicon-search"> </i> 搜索
			</button>
		</div>
		<div class="tabbable tabbable2">
			<ul class="nav nav-tabs padding-12 tab-color-blue background-blue">
				<li name="li_tab" data-identity="-1" class="active"><a
					href="javascript:;"> 全部登记（4） </a></li>
				<li name="li_tab" data-identity="2"><a href="javascript:;"> 达标办结（1）
				</a></li>
				<li name="li_tab" data-identity="1"><a href="javascript:;"> 未办结（3） </a></li>
			</ul>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div>
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>档案号</th>
								<th>建设单位</th>
								<th>项目名称</th>
								<th>项目地址</th>
								<th>净用地面积 （M²）</th>
								<th>审核面积（M²）</th>
								<th>审核公共绿地（M²）</th>
								<th>实留绿地面积（M²）</th>
								<th>实留公共绿地面积（M²）</th>
								<th>差额面积（M²）</th>
								<th>差额公共绿地面积（M²）</th>
								<th>差补缴费用（元）</th>
								<th>罚款</th>
								<th>收件日期</th>
								<th>联系人</th>
								<th>联系电话</th>
								<th>办结日期</th>
								<th>确认备注</th>
								<th>审核备注</th>
								<th>是否完工</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="data" style="display: table-row-group;">
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="pull-left">
			<a href="#greening/add">
				<button type="button" class="btn btn-info add" data-identity="add"
					title="登记新项目">
					<i class="ace-icon glyphicon glyphicon-plus"> </i>登记新项目
				</button>
			</a>
		</div>
		<!--分页-->
		<nav class="pull-right">
			<ul class="pagination">
				<li><a class="first" href="javascript:void(1);"
					aria-label="Previous"> 首页 </a></li>
				<li><a class="prev" href="javascript:void(1);"> <i
						class="ace-icon fa fa-angle-double-left"> </i>上一页
				</a></li>
				<li><a class="next" href="javascript:void(1);"> 下一页 <i
						class="ace-icon fa fa-angle-double-right"> </i>
				</a></li>
				<li><a class="last" href="javascript:void(1);" aria-label="Next"> 尾页
				</a></li>
				<li><a class="go_page" href="javascript:void(1);"> 跳转到 </a></li>
				<li><input type="text" style="width: 30px" class="go_num" value="1">
				</li>
				<li>页</li>
			</ul>
		</nav>
		<!-- TemplteHidden -->
		<table class="list-tpl hidden">
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td>
					<button type="button" class="btn btn-mini btn-info registration"
						data-identity="registration" title="实施情况确认">
						<i class="ace-icon glyphicon glyphicon-ok"> 确认登记 </i>
					</button>
					<button type="button" class="btn btn-mini btn-success verification"
						data-identity="verification" title="实施情况处理意见审查">
						<i class="ace-icon glyphicon glyphicon-retweet"> 审查登记 </i>
					</button>
					<button type="button" class="btn btn-mini btn-success print"
						data-identity="verification" title="监督检查报告">
						<i class="ace-icon glyphicon glyphicon-retweet"> 办结报告 </i>
					</button>
				</td>
			</tr>
		</table>
	</div>
</div>
<script type="text/javascript">var scripts = [null, null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	var $scope = $('.greening_list');
	//分页代码
	function pageInit(page) {
		$.getJSON(page.url, {
				page: page.pi
			},
			function(ret) {
				if (ret.status > 0) {
					var $data = $('.data', $scope);
					$data.hide();
					$data.empty();
					var data = ret.data;
					pageObj.set_page_count_without_action(ret.page_count);
					$("li[name='li_tab'][class='active'][data-identity='-1']>a",$scope).text("全部（"+ret.tct+"）");
					$("li[name='li_tab'][class='active'][data-identity='2']>a",$scope).text("达标办结（"+ret.db_ct+"）");
					$("li[name='li_tab'][class='active'][data-identity='1']>a",$scope).text("未办结（"+ret.wbj_ct+"）");
					for (var i in data) {
						var $item = $('.list-tpl tr', $scope).clone();
						var v = data[i];
						var id = v['id'];
						console.log(id);
						$('td:eq(0)', $item).text(v['docket_no']);
						$('td:eq(1)', $item).text(v['c_unit']);
						$('td:eq(2)', $item).text(v['p_name']);
						$('td:eq(3)', $item).text(v['p_address']);
						$('td:eq(4)', $item).text(v['jy_area']);
						$('td:eq(5)', $item).text(v['sh_area']);
						$('td:eq(6)', $item).text(v['shgy_area']);
						//console.log(v['slld_area'])
						$('td:eq(7)', $item).text(v['slld_area']);
						$('td:eq(8)', $item).text(v['slgyld_area']);
						console.log((v['sh_area']-v['slld_area']).toFixed(2))
						$('td:eq(9)', $item).text((v['sh_area']-v['slld_area']).toFixed(2));//差额面积
						$('td:eq(10)', $item).text((v['shgy_area']-v['slgyld_area']).toFixed(2));//差额公用绿地面积
						$('td:eq(11)', $item).text(v['cbj_cost']);
						$('td:eq(12)', $item).text(v['fine']);
						$('td:eq(13)', $item).text(FormatDate(v['sj_date'], 'yyyy-MM-dd'))
							//$('td:eq(13)',$item).text(v['sj_date']);
						$('td:eq(14)', $item).text(v['linkman']);
						$('td:eq(15)', $item).text(v['linkphone']);
						$('td:eq(16)', $item).text(FormatDate(v['bj_date'], 'yyyy-MM-dd'))
							//$('td:eq(15)',$item).text(v['bj_date']);
						$('td:eq(17)', $item).text(v['qr_remark']);
						$('td:eq(18)', $item).text(v['sh_remark']);
						$('td:eq(19)', $item).text(v['sfwg']);
						console.log(v['status']);
						if(v['status']==""||v['status']=="未办结")
						{ 
							
							$('td:eq(20) .registration', $item).attr('data-identity', 'registration-' + id);
							$('td:eq(20) .verification', $item).remove();
							$('td:eq(20) .print', $item).remove();	
						}
						if(v['status']=="确认登记")
						{
							$('td:eq(20) .verification', $item).attr('data-identity', 'opinion-' + id);
							$('td:eq(20) .print', $item).remove();
							$('td:eq(20) .registration', $item).remove();
						}
						if(v['status']=="审核登记"||v['status']=="达标办结")
						{
							$('td:eq(20) .print', $item).attr('data-identity', 'print-' + id);
							$('td:eq(20) .verification', $item).remove();
							$('td:eq(20) .registration', $item).remove();
						}
						$data.append($item);
					}
					$data.show();
				} else {
					pageObj.set_page_count_without_action(1);
					message_box.show(ret.data, 'error');
				}
			});
	}
	pageObj = new pagination({
		'url': '/greening/ajax_green_list',
		'page_count': 9,
		'show_callback': function(page) {
			pageInit(page);
		}
	});
	$('.first', $scope).click(function() {
		pageObj.first_page();
		$('.go_num', $scope).val('1');
	});
	$('.prev', $scope).click(function() {
		pageObj.prev_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	$('.next', $scope).click(function() {
		pageObj.next_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	$('.last', $scope).click(function() {
		pageObj.last_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	//跳转输入框
	$('.go_num', $scope).change(function() {
			var num = $(this).val();
			if (num > pageObj.get_page_count()) {
				$(this).val(pageObj.get_page_count());
			} else if (num < 1) {
				$(this).val(1);
			}
		})
		//跳转至指定页面
	$('.go_page', $scope).click(function() {
		var num = $('.go_num', $scope).val();
		pageObj.go_page(num);
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	$scope.delegate('[data-identity^="registration"]', 'click', function() {
		var id = $(this).attr('data-identity').split('-')[1];
		var url = '/greening/registration?id=' + id;
		gDialog.fCreate({
			title: '实施情况确认登记',
			url: url,
			width: 800	
		}).show();
	}).delegate('[data-identity^="opinion-"]', 'click', function() {
		var id = $(this).attr('data-identity').split('-')[1];
		var url = '/greening/opinion?id=' + id;
		gDialog.fCreate({
			title: '处理意见审查登记',
			url: url,
			width: 900
		}).show();
	}).delegate('[data-identity^="print-"]', 'click', function() {
		var id = $(this).attr('data-identity').split('-')[1];
		var url = '/greening/print?id=' + id;
		gDialog.fCreate({
			title: '处理意见审查登记',
			url: url,
			width: 800
		}).show();
	})

	function create_where() {
		var p_name = $("#hx_name", $scope).val() || "";
		var sfwg = $("hx_sfwg", $scope).val() || "";
		var tb = $("li[name='li_tab'][class='active']", $scope).attr("data-identity");
		var where = "?pname=" + p_name + "&tb=" +
			tb + "&sfwg=" + sfwg;
		return where;
	}
	$("li[name='li_tab']", $scope).click(function() {
		$("li[name='li_tab']").removeClass("active");
		$(this).addClass("active");
		url = '/greening/ajax_green_list' + create_where();
		pageObj = new pagination({
			'url': url,
			'page_count': 9,
			'show_callback': function(page) {
				pageInit(page);
			}
		});
	});
	$('.serach', $scope).click(function() {
		var url = '/greening/ajax_green_list' + create_where();
		pageObj = new pagination({
			'url': url,
			'page_count': 9,
			'show_callback': function(page) {
				pageInit(page);
			}
		});
	});
})</script>
